package com.ruan.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruan.pojo.Orders;
import com.ruan.query.OrdersQuery;
import com.ruan.service.OrdersService;
import com.ruan.vo.OrdersVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName:OrdersController
 * @Author:阮昇
 * @Description:
 * @Datetime: 2023/6/20 11:22
 **/
@RestController
@RequestMapping("/orders")
public class OrdersController {

    @Autowired
    private OrdersService ordersService;

    @RequestMapping("/getOrdersList")
    public PageInfo<OrdersVo> getOrdersList(OrdersQuery ordersQuery){
        //开启分页
        PageHelper.startPage(ordersQuery.getPageNum(),ordersQuery.getPageSize());

        List<OrdersVo> ordersList = ordersService.getOrdersList(ordersQuery);

        PageInfo<OrdersVo> pageInfo = new PageInfo<>(ordersList);

        return pageInfo;

    }

}
